package com.android.net.service

import android.content.Context
import android.os.Binder
import com.android.net.listener.OnAllDownloadsCompleteListener
import com.camera.base.bean.DownloadState
import com.camera.base.inerface.DownloadCallback

class DownloadBinder(context: Context?): Binder() {
    private val binderImpl: DownloadBinderImpl
    init {
        binderImpl = DownloadCommonBinder()
    }
    fun init(context: Context?) {
        binderImpl.init(context)
    }
    fun setOnAllDownloadsCompleteListener(listener: OnAllDownloadsCompleteListener){
        binderImpl.setOnAllDownloadsCompleteListener(listener)
    }
    fun startDownload(downloadUrl: String, localPath: String, callback: DownloadCallback) {
        binderImpl.startDownload(downloadUrl, localPath, callback)
    }
    fun pauseDownload(fileName: String) {
        binderImpl.pauseDownload(fileName)
    }
    fun resumeDownload(fileName: String) {
        binderImpl.resumeDownload(fileName)
    }
    fun cancelDownload(fileName: String) {
        binderImpl.cancelDownload(fileName)
    }
    fun getDownloadStateByPath(filePath: String): DownloadState?{
        return binderImpl.getDownloadStateByPath(filePath)
    }
}